import Vue from 'vue'
import VueRouter from 'vue-router'
import IndexLayout from '../layout/IndexLayout'
import Index from '../views/index/Index'

Vue.use(VueRouter)

const routes = [{
    path: '/',
    redirect: '/index'
}, {
    path: '/index',
    component: IndexLayout,
    children: [{
        path: '',
        component: Index
    }, {
        path: "more/:title/:type",
        name: "moreMusic",
        component: () => import('../views/MusicMore.vue')
    }, {
        path: 'bill',
        component: () => import('../views/bill/Bill.vue')
    },{
        path: 'my',
        component: () => import('../views/My.vue')
    }]
}, {
    path: "/test/list",
    component: () => import('../views/List.vue')
}, {
    path: '/detail/:id',
    component: () => import('../views/music-detail/MusicDetail')
}
    // {
    //   path: '/about',
    //   name: 'About',
    //   // route level code-splitting
    //   // this generates a separate chunk (about.[hash].js) for this route
    //   // which is lazy-loaded when the route is visited.
    //   // 动态加载这个路由，实现路由的懒加载
    //   component: () => import( /* webpackChunkName: "about" */ '../views/About.vue')
    // }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
